*use  "C:\Users\cxp641\Box\Article projects\COIN project\WoW_Pischedda_et_al.dta", clear

**************** Main empirical analyis

*Figure 1
graph twoway (lfit firepower yearend) (scatter firepower yearend,  msymbol(o) mcolor(black)),ylabel (10 5 0)  ytitle("Firepower")  xtitle("Year of war termination")


*Table 1
reg insurgent_success firepower, cluster(ccode) 
estimates store m1, title(Model 1)

reg insurgent_success firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end, cluster(ccode) 
estimates store m2, title(Model 2)

reg insurgent_success firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate, cluster(ccode) 
estimates store m3, title(Model 3)

reg insurgent_success firepower ipatron rear  regime power lenerpc ldis colonial_postwwii coldwar_end interstate decade1b decade2b decade3b decade4b decade5b decade6b decade7b decade8b decade9b decade10b decade11b decade12b decade13b decade14b decade15b decade16b decade17b decade18b decade19b decade20b, cluster(ccode) 
estimates store m4, title(Model 4)

reg insurgent_success firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate mech, cluster(ccode) 
estimates store m5, title(Model 5)

reg insurgent_success firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate troopspop, cluster(ccode) 
estimates store m6, title(Model 6)

esttab m1 m2 m3 m4 m5 m6 using Table1_WoW.rtf,  cells(b(star fmt(3)) t(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) noomitted


*Table 2
reg insurgent_success  firepower ipatron rear  regime power lenerpc ldis colonial_postwwii coldwar_end interstate rebel_strength2 strength_cent territorial_c, cluster(ccode) 
estimates store m1, title(Model 1)

*not reported for reasons of space but mentioned in text (same as a above, but alternative measures of rebel strength)
reg insurgent_success  firepower ipatron rear  regime power lenerpc ldis colonial_postwwii coldwar_end interstate fighting_cap strength_cent terr_strength2, cluster(ccode) 

reg insurgent_success  firepower ipatron rear  regime power lenerpc ldis colonial_postwwii coldwar_end interstate finance, cluster(ccode) 
estimates store m2, title(Model 2)

reg insurgent_success  firepower ipatron rear  regime power lenerpc ldis colonial_postwwii coldwar_end interstate ltradegdp, cluster(ccode) 
estimates store m3, title(Model 3)

reg insurgent_success firepower ipatron rear  regime power lenerpc ldis colonial_postwwii coldwar_end interstate marxist islamist, cluster(ccode) 
estimates store m4, title(Model 4)

reg insurgent_success firepower ipatron rear  regime power lenerpc ldis colonial_postwwii coldwar_end interstate media, cluster(ccode) 
estimates store m5, title(Model 5)

reg insurgent_success firepower ipatron rear  regime power lenerpc ldis colonial_postwwii coldwar_end interstate literacy, cluster(ccode) 
estimates store m6, title(Model 6)

esttab m1 m2 m3 m4 m5 m6 using Table2_WoW.rtf,  cells(b(star fmt(3)) t(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) noomitted



********************Online appendix
***Three figures showing secular trend of insurgent firepower, using alternative measures of firepower

*Figure 1a
graph twoway (lfit long_gun yearend) (scatter long_gun yearend,  msymbol(o) mcolor(black)),ylabel (5 0)  ytitle("Long Guns Indicator")  xtitle("Year of war termination")

*Figure 2a
graph twoway (lfit firepower2 yearend) (scatter firepower2 yearend,  msymbol(o) mcolor(black)),ylabel (7 0)  ytitle("Firepower2")  xtitle("Year of war termination")

*Figure 3a
graph twoway (lfit firepower_pca yearend) (scatter firepower_pca yearend,  msymbol(o) mcolor(black)),ylabel (3 0)  ytitle("Firepower PCA")  xtitle("Year of war termination")


***Table A1
*sum varname if firepower!=. (but full sample for variables only used to replicate Lyall' and Wilson 2009's models)


***Table A2, checking robustness to using a restricted sample and original outcome coding as well as both at the same time
reg insurgent_success firepower if no_guerrilla2==0, cluster(ccode) 
estimates store m1, title(Model 1)

reg insurgent_success firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate if no_guerrilla2==0, cluster(ccode) 
estimates store m2, title(Model 2)

reg insurgent_suc_original firepower, cluster(ccode) 
estimates store m3, title(Model 3)

reg insurgent_suc_original firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate, cluster(ccode) 
estimates store m4, title(Model 4)

reg insurgent_suc_original firepower if no_guerrilla2==0, cluster(ccode) 
estimates store m5, title(Model 5)

reg insurgent_suc_original firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate if no_guerrilla2==0, cluster(ccode) 
estimates store m6, title(Model 6)

esttab m1 m2 m3 m4 m5 m6 using TableA2_WoW.rtf,  cells(b(star fmt(3)) t(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) noomitted


***Table A3, replicating main analysis with alternative measures of firepower
reg insurgent_success long_gun, cluster(ccode) 
estimates store m1, title(Model 1)

reg insurgent_success long_gun ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate, cluster(ccode) 
estimates store m2, title(Model 2)

reg insurgent_success firepower2 , cluster(ccode) 
estimates store m3, title(Model 1)

reg insurgent_success firepower2 ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate, cluster(ccode) 
estimates store m4, title(Model 2)

reg insurgent_success firepower_pca, cluster(ccode) 
estimates store m5, title(Model 1)

reg insurgent_success firepower_pca ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate, cluster(ccode) 
estimates store m6, title(Model 2)

esttab m1 m2 m3 m4 m5 m6 using TableA3_WoW.rtf,  cells(b(star fmt(3)) t(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) noomitted


***Table A4, checking robustness to using ordinal logit and multinomial logit
*command to dowload brant test package
*findit spost13_ado
ologit correct_wdl_flip firepower, cluster(ccode)
estimates store m1, title(Model 1)
brant, detail
*the parallel regression assumption is violated

ologit correct_wdl_flip firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate, cluster(ccode) 
estimates store m2, title(Model 2)
brant, detail
*the parallel regression assumption is violated

mlogit correct_wdl_flip firepower, cluster(ccode) baseoutcome(0)
estimates store m3, title(Model 3)

mlogit correct_wdl_flip firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate, cluster(ccode) baseoutcome(0)
estimates store m4, title(Model 4)

esttab m1 m2 m3 m4 using TableA4_WoW.rtf,  cells(b(star fmt(3)) t(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) noomitted


***Table A5, comparing effects of main battery of controls  with and without Firepower 
reg insurgent_success firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate, cluster(ccode) 
estimates store m1, title(Model 1)

reg insurgent_success ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate if firepower!=., cluster(ccode) 
estimates store m2, title(Model 1)

esttab m1 m2 using TableA5_WoW.rtf,  cells(b(star fmt(3)) t(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) noomitted


***Table A6, adding world regional dummies 
reg insurgent_success firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate eeurop americas ssafrica asia nafrme, cluster(ccode) 
estimates store m3, title(Model 3)

esttab m3 using TableA6_WoWCOIN.rtf,  cells(b(star fmt(3)) t(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) noomitted



***Table A7, Lyall and Wilson's own analysis, with and without firepower
*model 5, table 3 in Lyall and Wilson 2009
ologit wdl_flip mech if firepower!=., cluster(ccode)
estimates store m1, title(Model 1)

ologit wdl_flip firepower mech, cluster(ccode)
estimates store m2, title(Model 2)

**model 6, table 3 in Lyall and Wilson 2009
ologit wdl_flip mech regime occ lenerpc support lelev ldis power if firepower!=., cluster(ccode)
estimates store m3, title(Model 3)

ologit wdl_flip firepower mech regime occ lenerpc support lelev ldis power, cluster(ccode)
estimates store m4, title(Model 4)

*model 7, table 3 in Lyall and Wilson 2009
ologit wdl_flip mech regime occ lenerpc support lelev ldis power  ltradegdp numlang if firepower!=., cluster(ccode)
estimates store m5, title(Model 5)

ologit wdl_flip firepower mech regime occ lenerpc support lelev ldis power ltradegdp numlang, cluster(ccode)
estimates store m6, title(Model 6)

esttab m1 m2 m3 m4 m5 m6 using TableA7_WoW.rtf,  cells(b(star fmt(3)) t(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) noomitted


***Table A8, Lyall and Wilson's own analysis, with and without firepower 
*model 10, table 4 in Lyall and Wilson 2009
ologit wdl_flip mech regime occ lenerpc support lelev ldis power coldwar above below if firepower!=., ro
estimates store m7, title(Model 7)

ologit wdl_flip firepower mech regime occ lenerpc support lelev ldis power coldwar above below, ro
estimates store m8, title(Model 8)

*model 12, table 4 in Lyall and Wilson 2009
ologit wdl_flip mech regime occ lenerpc support lelev ldis power coldwar eeurop lamerica  ssafrica asia nafrme namerica if firepower!=., ro
estimates store m9, title(Model 9)

ologit wdl_flip firepower mech regime occ lenerpc support lelev ldis power coldwar eeurop lamerica  ssafrica asia nafrme namerica, ro
estimates store m10, title(Model 10)

*model 13, table 4 in Lyall and Wilson 2009
ologit wdl_flip mech support power lelev ldis regime lenerpc coldwar occ nwstate if firepower!=., cluster(ccode)
estimates store m11, title(Model 11)

ologit wdl_flip firepower mech support power lelev ldis regime lenerpc coldwar occ nwstate, cluster(ccode)
estimates store m12, title(Model 18)

esttab m7 m8 m9 m10 m11 m12 using TableA8_WoW.rtf,  cells(b(star fmt(3)) t(par fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) noomitted


*Table A9 (sensitivity, using baseline specification from model 3 in table 1)
sensemakr insurgent_success firepower ipatron rear regime power lenerpc ldis colonial_postwwii coldwar_end interstate, treat(firepower) benchmark(ipatron) 











